<?php 

class ContactAction extends BaseAction{
	/**
	 * Ceramics
	 */
	function index(){
		$this->display();
		exit();
		$cid=intval($_GET['cid']);  //获取栏目ID
		if($cid==0){$cid=90;}
		$db=M("category");
		//$aboutinfo = M("category")->where($map)->order(array("orderid"=>"asc","id"=>"desc"))->find();
		if($r=$db->where(array("id"=>$cid,"checkinfo"=>0))->find()){
			$aboutinfo=$r;
			if($aboutinfo['seotitle']==''){
				$aboutinfo['seotitle']=$aboutinfo['classname'].'-'.C('cfg_webname');
			}
			if($aboutinfo['keywords']==''){
				$aboutinfo['keywords']=C('cfg_keyword');
			}
			if($aboutinfo['description']==''){
				$aboutinfo['description']=C('cfg_description');
			}
			$db->where(array("id"=>$cid,"checkinfo"=>0))->setInc('hits',1);
		}else{
			showMsg("参数错误");
			exit;
		}
		$map1['pid'] = $aboutinfo['pid'];
		$map1['checkinfo'] =0;
		$aboutcat = M("category")->where($map1)->order(array("orderid"=>"asc","id"=>"desc"))->select();
		
		if($aboutinfo['modelid']==1){//列表性质
			$aboutlist = M("content")->where(array("pid"=>$cid,"checkinfo"=>0))->order(array("orderid"=>"asc","posttime"=>"desc","id"=>"desc"))->select();
		}
		$this->assign("aboutcat",$aboutcat);
		$this->assign("aboutinfo",$aboutinfo);
		$this->assign("aboutlist",$aboutlist);
		$this->assign("menucss7","on");
		$this->display();
	} 
	function map(){
		$aboutinfo=array();
		$aboutinfo['pid']=90;
		$aboutinfo['seotitle']='电子地图-'.C('cfg_webname');
		$this->assign("aboutinfo",$aboutinfo);
		$this->assign("menucss7","on");
		$this->display();
	}
	
	function send(){
		if($_POST['UserName']=="1"||$_POST['email']==""||$_POST['company']==""||$_POST['message']==""){
			//$this->msg('请填写完整留言信息',U('contact/index'));
			echo '<script>alert("请填写完整留言信息");history.back();</script>';
			exit();
		}
		$t=D('message');
		$_POST['info']['username']=$_POST['UserName'];	
		$_POST['info']['tel']=$_POST['mobile'];	
		$_POST['info']['email']=$_POST['email'];	
		$_POST['info']['content']=$_POST['message'];	
		$_POST['info']['posttime']= time();
		
		$_POST['info']['content_arr']['industry']=$_POST['industry'];	
		$_POST['info']['content_arr']['company']=$_POST['company'];
		$_POST['info']['content_arr']['address']=$_POST['address'];
		$_POST['info']['content_arr']['address2']=$_POST['address2'];
		$_POST['info']['content_arr']['city']=$_POST['city'];	
		$_POST['info']['content_arr']['postcode']=$_POST['postcode'];	
		$_POST['info']['content_arr']['countries']=$_POST['countries'];	
		$_POST['info']['content_arr']['product_series']=$_POST['product_series'];	
		$_POST['info']['content_arr']['product_title']=$_POST['product_title'];	
		$_POST['info']['content_arr']=jsonEscape(json_encode($_POST['info']['content_arr']));
			//print_r($_POST['info']);
			//	exit;
		
		if($row=$t->create($_POST['info'])){
			//print_r($row['content_arr']);
			if($t->add()){
					$this->msg('留言成功',U('contact/index'));
					//echo '留言成功';
				}else{
					$this->msg('留言失败，请重新操作',U('contact/index'),1);
					//echo '留言失败';
				}
			//echo $t->getLastSql()."";
		}else{
			$this->msg('请先填写留言内容！',U('content/index'),1);
		}
	}



}
